package web.common.core.message;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import web.common.core.collection.Page;

import java.util.List;

/**
 * @author Jin Zheng
 * @since 1.0 2022-01-21
 */
@Getter
@Setter
@NoArgsConstructor
public class PageResponse<T> {
    private int pageIndex;
    private int pageSize;
    private int totalPage;
    private int totalResult;
    private List<T> results;

    public void setPage(Page page, List<T> list) {
        this.setPageIndex(page.getPageIndex());
        this.setPageSize(page.getPageSize());
        this.setTotalPage(page.getTotalPage());
        this.setTotalResult(page.getTotalResult());
        this.setResults(list);
    }

}
